package main

import (
	"distributed/conf"
	"distributed/worker"
	"fmt"
)

func init() {
	conf.LoadConfig()

	worker.RpcConnect()
	go worker.PushResult()
}

func main() {
	// todo: rpc-client -> server
	for i := 0; i < worker.ThreadNum-1; i++ {
		go worker.PostFunction()
	}
	fmt.Printf("[ WorkerClient running success ]")
	worker.PostFunction()
	//if err := rpc.Register(&worker.Worker{}); err != nil {
	//	panic(err)
	//}
	//
	//rpc.HandleHTTP()
	//fmt.Println("[ worker ] run in :", conf.GetConfig("worker_port"))
	//if err := http.ListenAndServe(conf.GetConfig("worker_port"), nil); err != nil {
	//	panic(err)
	//}
}
